home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d1 / ansi_sys.arc / NANSI.PAT < prev    next >
Text File  |  1986-10-14  |  4KB  |  83 lines

  1. This is a minimal patch to NANSI.ASM that will get rid of most flicker 
  2. on the IBM CGA or equivalent.  Source lines in all caps are from 
  3. NANSI.ASM as distributed; lowercase lines are to be added.  This goes, 
  4. as you can see, in F_T_NCTL (thanks for the tip, Seeds!).  After 
  5. changing these lines (in a *copy* of NANSI.ASM), assemble and link as 
  6. follows:
  7.  
  8. MASM NANSI
  9. MASM NANSI_P
  10. MASM NANSI_F
  11. MASM NANSI_I
  12.  
  13. (You'll need to have NANSI_D in the same directory as NANSI.ASM.  
  14. Ignore the error messages.)
  15.  
  16. LINK NANSI NANSI_P NANSI_F NANSI_I 
  17.  
  18. (Ignore stack and error warnings.)
  19.  
  20. EXE2BIN NANSI NANSI.SYS
  21.  
  22. Copy NANSI.SYS to your boot disk/directory and add
  23.  
  24. DEVICE=NANSI.SYS
  25.  
  26. to your CONFIG.SYS file.
  27.  
  28. The patch works by examining the Display Status bit (bit 0) of the 
  29. status bite from video port 3DA.  If the display is inactive, it might 
  30. be nearly ready to turn on; we wait for it to activate and deactivate 
  31. again before writing to the screen.  Yes, it slows screen updates 
  32. slightly, but if you toggle raw mode on (using Chris Dunford's 
  33. RAW.COM), the delay is minimal.
  34.  
  35. There will occasionally be a slight bit of snow in the first column or 
  36. two of the screen.  This seems to happen when screen updates are 
  37. synched with display activation/deactivation so the display turns on 
  38. just as the updating is taking place.  One could add another loop to 
  39. wait for the display to turn off/on/off before writing, but the delay 
  40. would probably be noticable.  
  41.  
  42. As I said, this is a minimal fix; a serious one would check video mode 
  43. to bypass all of this on the monochrome adaptor or EGA.  DON'T USE THE 
  44. MODIFIED NANSI.SYS ON A MONOCHROME MACHINE!  
  45.  
  46. F_T_NCTL:
  47.        SEG_CS
  48.        XLAT
  49.  
  50. ; Patch starts here
  51.  
  52.        push    dx                      ;
  53.        push    ax                      ; DX and AX get wiped out
  54.        mov     dx,3DAh                 ; address of video status port 
  55. f_wait_for_on:
  56.        in      al,dx                   ; get status
  57.        ror     al,1h                   ; check display active bit
  58.        jc      f_wait_for_on           ; if inactive, loop
  59.        cli                             ; don't delay next routine
  60. f_wait_for_off:
  61.        in      al,dx                   ; get status
  62.        ror     al,1h                   ; check display active bit
  63.        jnc     f_wait_for_off          ; if active, loop
  64.        pop     ax                      ; get AX back
  65.  
  66. ; This is from NANSI source ...
  67.  
  68.        STOSW                           ; Put Char! (es:[di++] = ax)
  69.  
  70. ; ...but this has to be added
  71.  
  72.        sti                             ; put phone back on hook
  73.        pop     dx                      ; get DX back for count
  74.  
  75. Note that this is *very* clock-cycle dependent; hence the use of RORs, 
  76. etc.  In fact, an earlier version JCed to POP AX if the display was 
  77. inactive, but since it takes sixteen cycles to jump--as compared to 
  78. only four not to jump--the display would often become active during 
  79. the jump, and snow would appear in the left 1/3 of the screen.  The 
  80. occasional snow in column 1 seems to result from display activation 
  81. during the consideration of the JNC or during the POP AX; adding the 
  82. CLI/STI eliminates most of it.